<?php
use Helper\Curl;
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="content-type" content="text/html">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>个人中心-发布产品</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="stylesheet" href="/public/css/base.css">
    <link rel="stylesheet" href="/public/css/public.css">
    <link rel="stylesheet" href="/public/css/uc.css">
</head>
<body class="homeMain">
<!--    公共头部    -->
<?php load_view("inc/ucheader");?>

<!--   content   -->
<div class="container">
    <!--   面包屑   -->
    <div class="crumbs">您的位置：<span>首页 ></span><span> 个人中心</span></div>
    <div class="uc_box cf">
        <?php load_view("inc/ucleft");?>
        <div class="uc_right fr">
            <p class="info_title">填写信息</p>
            <form action="<?=Curl::createUrl("/Uc/productrelease")?>" method="post" enctype="multipart/form-data">
                <div class="fill_box">
                    <div class="fill_p">
                        <span class="classify_left">游戏分类：</span>
                        <span class="select">
                            <select name="shop_type">
                                <option value ="">--发布信息分类--</option>
                                <option value ="金币交易">金币交易</option>
                                <option value ="账号交易">账号交易</option>
                                <option value ="装备交易">装备交易</option>
                                <option value ="游戏代练">游戏代练</option>
                            </select>
                        </span>
                        <span class="select">
                            <select id="type_select" onclick="myFunction3()" onchange="send(this.value,'type_select')" name="type_select">
                                <option value ="">--游戏分类--</option>
                                <?php foreach ($gametype as $key=>$value): ?>
                                <option value ="<?=$value['id']?>"><?=$value['type']?></option>
                                <?php endforeach; ?>
                            </select>
                        </span>
                        <span class="select">
                            <select id="name_select" onclick="myFunction4()" onchange="send(this.value,'name_select')" name="name_select">
                                <option value ="游戏名称">--游戏名称--</option>
                            </select>
                        </span>
                        <span class="select">
                            <select id="area_select" onclick="myFunction5()" name="area_select">
                                <option value ="游戏区">--游戏区--</option>
                            </select>
                        </span>
                    </div>
                    <div class="fill_p">
                        <span class="classify_left">商品标题：</span>
                        <input class="title_input" id="text_input" oninput="myFunction()" type="text" name="title_input" required placeholder="建议填写个性化商品标题，可吸引人眼球">
                        <span class="title_text">请输入商品标题，保持在40字以内</span>
                    </div>
                    <div class="fill_p">
                        <span class="classify_left">商品单价：</span>
                        <input class="money_input" oninput="myFunction1()" id="money_input" type="text" name="money_input" required placeholder="0">
                        <span class="money_text">元</span>
                    </div>
                    <div class="fill_p">
                        <span class="classify_left">发布数量：</span>
                        <input class="money_input" oninput="myFunction2()" id="input_num" type="number" name="input_num" required placeholder="1">
                        <span class="money_text">件</span>
                    </div>
                    <div class="fill_p">
                        <span class="classify_left">商品描述：</span>
                        <textarea class="des_textarea" rows="3" cols="20" name="info" required  placeholder="请勿填写与本商品无关的广告信息和联系方式，否则您的账号会被封禁"></textarea>
                        <span class="title_text">请输入商品描述，保持在40字以内</span>
                    </div>
                    <div class="fill_p">
                        <span class="classify_left">游戏规格：</span>
                        <textarea class="des_textarea" rows="3" cols="20" name="spec" required  placeholder="示例如下：&#10;QQ等级：QQ等级40级以上&#10;角色等级：QQ等级40级以上&#10;角色职业：剑圣"></textarea>
                        <span class="title_text">请输入商品规格，保持在40字以内</span>
                    </div>
                    <div class="fill_p">
                        <span class="classify_left">游戏图标：</span>
                        <span class="file-box pr"><span id="filename">点击此处上传文件</span><input onchange="getFilename();yl(this,'ylimg')" class="file-btn" name="fileicon" id="file" onclick="getFilename()" type="file" /></span><span class="title_text">选择上传的图片最佳是120px*120px</span>
                    </div>
                    <div class="fill_p">
                        <span class="classify_left">商品图片：</span>
                        <span class="file-box pr"><span id="filename2">点击此处上传文件</span><input class="file-btn" type="file"  name="filecontent[]" id="file2" multiple onchange="getFilename2()" /></span><span class="title_text">选择上传的图片最佳是1200px*300px</span>
                    </div>
                    <div class="sure_btn">
                        <input type="submit" value="确定发布">
                    </div>
                </div>
            </form>
            <div class="preview">
                <div class="pre_h cf"><span class="pre_title fl">商品预览</span><span class="pre_price fl">单价</span><span class="pre_num fl">数量</span><span class="pre_rece fl">应收</span></div>
                <div class="pre_box cf">
                    <div class="fl pre_title cf">
                        <img src="/public/images/banner/uc_logo.png" id="ylimg" width="120" height="120" class="fl list_img" alt="">
                        <div class="fl pre_text">
                            <p class="ofh" id="pre_title"></p>
                            <p class="ofh">商品种类: <span id="pre_type"></span></p>
                            <p class="ofh">游戏/区/服: <span id="pre_area1"></span><span id="pre_area2"></span></p>
                        </div>
                    </div>
                    <div class="pre_price pre_l fl"><span>￥</span><span id="pre_price"></span></div>
                    <div class="pre_num pre_l fl"><span id="pre_num"></span><span>件</span></div>
                    <div class="pre_rece pre_l fl"><span>￥</span><span id="pre_rece"></span></div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/public/js/jquery.js"></script>
<script src="/public/js/public.js"></script>
<script src="/public/js/uc.js"></script>
<script>
function send(data,type) {
    $.post("/Uc/ajaxproduct",{d:data,t:type},function (msg) {
        if(type == "type_select"){
            $("#name_select").empty();
            var optstr = "<option value =''>--游戏名称--</option>";
            for(var i = 0;i < msg.length; i++){
                optstr += "<option value ="+msg[i].id+">"+msg[i].title+"</option>";
            }
            $(optstr).appendTo($("#name_select"));
        }else{
            $("#area_select").empty();
            var optstr = "<option value =''>--游戏区--</option>";
            for(var i = 0;i < msg.length; i++){
                optstr += "<option value ="+msg[i].id+">"+msg[i].title+"</option>";
            }
            $(optstr).appendTo($("#area_select"));
        }
    },"json");
}    
</script>
</body>
</html>